﻿using System;
using DC2010.Effects;
using DC2010.Objects.Base;

namespace DC2010.Objects.Data
{
    [Serializable]
    public class EffectData : BaseData
    {
        /// <summary>
        /// Is this effect active? Active means that charges are consumed and effect are applied...
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// This simply means that this effect have asociated icon which is displayed
        /// </summary>
        public bool IsBuff { get; set; }

        /// <summary>
        /// How many times u can use this effect
        /// </summary>
        public CurrentNormal Charges{ get; set; }  

        public EffectGfx Gfx
        {
            get
            {
                if (!string.IsNullOrEmpty(GfxId))
                {
                    return Root.I.EffectSystem.GetGfx(GfxId);
                }

                return null;
            }
        }			

        private EffectLogic _l;
        public EffectLogic L
        {
            get
            {
                if (_l == null)
                    _l = Root.I.EffectSystem.InstantiateEffect(this);

                return _l;
            }
        }
    }
}
